1‘SAVE“REGPAT”
1000‘ Reqistration of Patient for BASIC
1010‘ Copyiqht 1986 (C)by K.Kimura
1020 DEFINT A-Z
1030 DIM NAM$(1000),ID$(1000)
1040 GOSUB 5000
1100 DATA“ 氏名 :”,“ 受診カード番号:”,“ 性別 :”
1110 DATA“ 生年月日 :”,“ コメント:”
1120 RESTORE 1100: FOR I=1 TO 5:READ MSG$(I):NEXT I
1200 GOSUB 1500:IF SW=5 THEN 1250
1210 IF SW=-1 THEN 1200
1220 IF SW<>0 THEN ON SW GOSUB 2500,2500,3000,4000:GOTO 1200
1230 FOR I=2 TO 5:GOSUB 2000:NEXT I
1240 GOSUB 2100:GOTO 1200
1250 GOSUB 5500
1260 PRINT:PRINT“***END OF JOB***”
1270 END
1280 ’
1500 SW=0
1510 PRINT:PRINT MSG$(1);:LINE INPUT DAT$
1520 IF DAT$=“+”THEN SW=3:GOTO 1550
1530 IF DAT$=“*”THEN SW=4:GOTO 1560
1540 IF DAT$=“/”THEN SW=5:GOTO 1560
1550 IF (LEFT$(DAT$,2)>=“00”)AND(LEFT$(DAT$,2)<=“99”)THEN GOSUB 1570
ELSE GOSUB 1620
1560 RETURN
1570 SW=-1
1580 FOR J=1 TO N
1590 IF ID$(J)=DAT$ THEN SW=2: NJ=J: J=N+1
1600 NEXT J
1610 RETURN
1620 FOR J=1 TO N
1630 IF NAM$(J)=DAT$ THEN SW=1: NJ=J: J=N+1
1640 NEXT J
1650 RETURN
1660 ’
2000 PRINT MSG$(I);:LINE INPUT DAT$(I)
2010 RETURN
2020 ’
2100 N=N+1:INF$=DAT$(2)
2110 FOR I=3 TO 5:INF$=INF$+“!”+DAT$(I):NEXT I
2120 LSET A$=DAT$ LSET B$=INF$:PUT #1.N
2130 NAM$(N)=DAT$:ID$(N)=DAT$(2)
2140 RETURN
2150 ’
2500 GET #1,NJ:GOSUB 2800
2510 IF SW=2 THEN PRINT MSG$(1),DAT$
2520 FOR I=2 TO 5:PRINT MSG$(I);:GOSUB 2600:NEXT I
2530 RETURN
2600 ZZ$=INF$+“!”:EP=0
2610 FOR Z0=1 TO I-1:SP=EP+1:EP=INSTR(SP,ZZ$,“!”):NEXT ZO
2620 IF EP=0 THEN EP=LEN(INF$)
2630 PRINT MID$(ZZ$,SP,EP-SP)
2640 RETURN
2650 ’
2800 FOR K=LEN(A$)TO 1 STEP -1
2810 IF MID$(A$,K,1)<>“ ”THEN KL=K:K=0
2820 NEXT K:DAT$=LEFT$(A$,KL)
2830 FOR K=LEN(B$)TO 1 STEP -1
2840 IF MID$(B$,K,1)<>“ ”THEN KL=K: K=0
2850 NEXT K: INF$=LEFT$(B$,KL)
2860 RETURU
2870 ’
3000 ORD(1)=0:ERASE ORD:DIM ORD(N)
3010 FOR J=1 TO N:ORD(J)=J:NEXT J
3020 FOR J=1 TO N-1
3030 FOR K=J TO N
3040 IF NAM$(ORD(J))>NAM$(ORD(K))THEN SWAP ORD(J),ORD(K)
3050 NEXT K,J:PRINT
3060 FOR J=1 TO N
3070 NJ=OPD(J):GET #1,NJ:GOSUB 2800
3080 PRINT DAT$;“:”;INF$
3090 NEXT J
3100 RETURN
3110 ’
4000 ORD(1)=0:ERASE ORD:DIM(N)
4010 FOR J=1 TO N:ORD(J)=J:NEXT J
4020 FOR J=1 TO N-1
4030 FOR K=J TO N
4040 IF ID$(ORD(J))>ID$(ORD(K))THEN SWAP ORD(J),ORD(K)
4050 NEXT K,J:PRINT
4060 FOR J=1 TO N
4070 NJ=ORD(J):GET #1,NJ:GOSUB 2800
4080 PRINT DAT$ ;“:”;INF$
4090 NEXT J
4100 RETURN
4110 ’
5000 OPEN “PATNAM”AS #1:CLOSE#1:OPEN “PATID”AS #1:CLOSE #1
5010 OPEN “PATNAM”FOR INPUT AS #1
5020 OPEN “PATID”FOR INPUT AS #2
5030 N=0
5040 WHILE NOT EOF(1)
5050 N=N+1
5060 LINE INPUT #1,NAM$(N):LINE INPUT #2,ID$(N)
5070 WEND:NOLD=N
5080 CLOSE #1 ,#2
5090 OPEN “PATDAT”AS #1
5100 FIELD #1,20 AS A$,236 AS B$
5110 RETURN
5120 ’
5500 IF N=NOLD THEN 5570
5510 CLOSE #1
5520 OPEN “PATNAM”FOR APPEND AS #1
5530 OPEN “PATID”FOR APPEND AS #2
5540 FOR J=NOLD+1 TO N
5550 PRINT #1,NAM$(J):PRINT #2,ID$(J)
5560 NEXT J
5570 CLOSE #1,#2
5580 RETURN