test_user пре 4 месеци
родитељ
комит
aad0ab6639

+ 153 - 45
controllers/sg/his_api_controller.go Прегледај датотеку

@@ -14,7 +14,7 @@ import (
14 14
 	"fmt"
15 15
 	//"github.com/tjfoc/gmsm/sm2"
16 16
 	//"github.com/tjfoc/gmsm/sm3"
17
-
17
+	"github.com/go-ole/go-ole"
18 18
 	"gdyb/controllers"
19 19
 	"gdyb/enums"
20 20
 	"gdyb/models"
@@ -2525,10 +2525,11 @@ func (c *HisApiController) GetCFYLJG001() {
2525 2525
 			flow.OriginalRxFile = ""
2526 2526
 			flow.OriginalValue = ""
2527 2527
 			flow.SignCertDn = ""
2528
+			flow.UserOrgId = 10454
2528 2529
 			flow.SignCertSn = ""
2529 2530
 			flow.Mtime = time.Now().Unix()
2530
-			flow.ID = 0
2531
-			service.Createflow(flow)
2531
+
2532
+			service.Createflow(&flow)
2532 2533
 			c.ServeSuccessJSON(map[string]interface{}{
2533 2534
 				"msg": "上传成功",
2534 2535
 			})
@@ -2537,14 +2538,18 @@ func (c *HisApiController) GetCFYLJG001() {
2537 2538
 }
2538 2539
 func (c *HisApiController) GetCFYLJG002() {
2539 2540
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2540
-
2541
-	id, _ := c.GetInt64("id")
2541
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2542
+	record_time := c.GetString("record_time")
2543
+	admin_user_id = 3626
2544
+	his, _ := service.GetHisPatientRecord(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
2545
+	//id, _ := c.GetInt64("id")
2542 2546
 	admin_user_id = 3626
2543 2547
 	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
2544 2548
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2545
-	flow, _ := service.Getflow(id)
2546
-	his, _ := service.GetHisPatientByNumber(flow.MID)
2547
-	record_time := c.GetString("record_time")
2549
+
2550
+	flow, _ := service.Getflowtwo(his.Number)
2551
+	//his, _ := service.GetHisPatientByNumber(flow.MID)
2552
+	//record_time := c.GetString("record_time")
2548 2553
 	patient_id, _ := c.GetInt64("patient_id")
2549 2554
 	//patient_id = 23834
2550 2555
 	//record_time = "2023-09-18"
@@ -2640,15 +2645,17 @@ func (c *HisApiController) GetCFYLJG002() {
2640 2645
 }
2641 2646
 func (c *HisApiController) GetCFYLJG003() {
2642 2647
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2643
-
2644
-	id, _ := c.GetInt64("id")
2648
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2649
+	record_time := c.GetString("record_time")
2650
+	admin_user_id = 3626
2651
+	his, _ := service.GetHisPatientRecord(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
2652
+	//id, _ := c.GetInt64("id")
2645 2653
 	admin_user_id = 3626
2646
-	//id  = 3
2647 2654
 	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
2648 2655
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2649
-	flow, _ := service.Getflow(id)
2650
-	his, _ := service.GetHisPatientByNumber(flow.MID)
2651
-	record_time := c.GetString("record_time")
2656
+
2657
+	flow, _ := service.Getflowtwo(his.Number)
2658
+	//id  = 3
2652 2659
 	patient_id, _ := c.GetInt64("patient_id")
2653 2660
 	//patient_id = 23834
2654 2661
 	//record_time = "2023-09-18"
@@ -2728,15 +2735,17 @@ func (c *HisApiController) GetCFYLJG003() {
2728 2735
 }
2729 2736
 func (c *HisApiController) GetCFYLJG004() {
2730 2737
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2731
-
2732
-	id, _ := c.GetInt64("id")
2738
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2739
+	record_time := c.GetString("record_time")
2740
+	admin_user_id = 3626
2741
+	his, _ := service.GetHisPatientRecord(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
2742
+	//id, _ := c.GetInt64("id")
2733 2743
 	admin_user_id = 3626
2734
-	//id  = 3
2735 2744
 	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
2736 2745
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2737
-	flow, _ := service.Getflow(id)
2738
-	//his, _ := service.GetHisPatientByNumber(flow.MID)
2739
-	record_time := c.GetString("record_time")
2746
+
2747
+	flow, _ := service.Getflowtwo(his.Number)
2748
+	//id  = 3
2740 2749
 	patient_id, _ := c.GetInt64("patient_id")
2741 2750
 	//patient_id = 23834
2742 2751
 	//record_time = "2023-09-18"
@@ -2793,19 +2802,26 @@ func (c *HisApiController) GetCFYLJG004() {
2793 2802
 }
2794 2803
 func (c *HisApiController) GetCFYLJG005() {
2795 2804
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2805
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2806
+	//record_time := c.GetString("record_time")
2807
+	admin_user_id = 3626
2808
+	his, _ := service.GetHisPatientRecord(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
2809
+	//id, _ := c.GetInt64("id")
2810
+	admin_user_id = 3626
2796 2811
 	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
2797 2812
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2813
+
2814
+	flow, _ := service.Getflowtwo(his.Number)
2815
+	//id  = 3
2798 2816
 	var cFYLJG005 models.CFYLJG005
2799
-	id, _ := c.GetInt64("id")
2800
-	patient_id, _ := c.GetInt64("patient_id")
2801
-	patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
2802
-	flow, _ := service.Getflow(id)
2817
+
2818
+	//patient_id, _ := c.GetInt64("patient_id")
2803 2819
 	cFYLJG005.HiRxno = flow.HiRxno
2804 2820
 	cFYLJG005.MdtrtID = flow.MID
2805 2821
 	cFYLJG005.EcToken = ""
2806
-	cFYLJG005.PsnName = patient.Name
2822
+	cFYLJG005.PsnName = his.Name
2807 2823
 	cFYLJG005.PsnCertType = "01"
2808
-	cFYLJG005.Certno = patient.IdCardNo
2824
+	cFYLJG005.Certno = his.IdCardNo
2809 2825
 	result, request := service.GetCFYLJG005(miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, cFYLJG005)
2810 2826
 	saveLog(result, request, "GetCFYLJG005", "GetCFYLJG005")
2811 2827
 
@@ -2837,13 +2853,19 @@ func (c *HisApiController) GetCFYLJG005() {
2837 2853
 }
2838 2854
 func (c *HisApiController) GetCFYLJG006() {
2839 2855
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2856
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2857
+	admin_user_id = 3626
2858
+	his, _ := service.GetHisPatientRecord(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
2859
+	//id, _ := c.GetInt64("id")
2860
+	admin_user_id = 3626
2840 2861
 	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
2841 2862
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2842
-	var cFYLJG006 models.CFYLJG006
2843
-	id, _ := c.GetInt64("id")
2863
+
2864
+	flow, _ := service.Getflowtwo(his.Number)
2865
+	//id  = 3
2844 2866
 	patient_id, _ := c.GetInt64("patient_id")
2867
+	var cFYLJG006 models.CFYLJG006
2845 2868
 	patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
2846
-	flow, _ := service.Getflow(id)
2847 2869
 	cFYLJG006.HiRxno = flow.HiRxno
2848 2870
 	cFYLJG006.MdtrtID = flow.MID
2849 2871
 	cFYLJG006.PsnName = patient.Name
@@ -2851,19 +2873,48 @@ func (c *HisApiController) GetCFYLJG006() {
2851 2873
 	cFYLJG006.Certno = patient.IdCardNo
2852 2874
 	result, request := service.GetCFYLJG006(miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, cFYLJG006)
2853 2875
 	saveLog(result, request, "GetCFYLJG006", "GetCFYLJG006")
2854
-
2876
+	var res ResultCFYLJG006
2877
+	var respJSON2 map[string]interface{}
2878
+	if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
2879
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2880
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2881
+		return
2882
+	}
2883
+	userJSONBytes2, _ := json.Marshal(respJSON2)
2884
+	if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
2885
+		utils.ErrorLog("解析失败:%v", err)
2886
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2887
+		return
2888
+	}
2889
+	if res.Infcode == -1 {
2890
+		c.ServeSuccessJSON(map[string]interface{}{
2891
+			"failed_code": -10,
2892
+			"msg":         res.ErrMsg,
2893
+		})
2894
+		return
2895
+	} else {
2896
+		c.ServeSuccessJSON(map[string]interface{}{
2897
+			"info": res.Output,
2898
+		})
2899
+		return
2900
+	}
2855 2901
 }
2856 2902
 func (c *HisApiController) GetCFYLJG007() {
2857 2903
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2904
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2905
+	admin_user_id = 3626
2906
+	his, _ := service.GetHisPatientRecord(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
2907
+	//id, _ := c.GetInt64("id")
2908
+	admin_user_id = 3626
2858 2909
 	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
2859 2910
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2860
-	var cFYLJG007 models.CFYLJG007
2861
-	id, _ := c.GetInt64("id")
2911
+
2912
+	flow, _ := service.Getflowtwo(his.Number)
2913
+	//id  = 3
2862 2914
 	patient_id, _ := c.GetInt64("patient_id")
2915
+	var cFYLJG007 models.CFYLJG007
2863 2916
 	patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
2864 2917
 	//his, _ := service.GetHisPatient(c.GetAdminUserInfo().CurrentOrgId,patient_id)
2865
-	flow, _ := service.Getflow(id)
2866
-	his, _ := service.GetHisPatientByNumber(flow.MID)
2867 2918
 
2868 2919
 	cFYLJG007.HiRxno = flow.HiRxno
2869 2920
 	cFYLJG007.MdtrtID = flow.MID
@@ -2874,7 +2925,7 @@ func (c *HisApiController) GetCFYLJG007() {
2874 2925
 	result, request := service.GetCFYLJG007(miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, cFYLJG007)
2875 2926
 	saveLog(result, request, "GetCFYLJG007", "GetCFYLJG007")
2876 2927
 
2877
-	var res ResultCFYLJG006
2928
+	var res ResultCFYLJG007
2878 2929
 	var respJSON2 map[string]interface{}
2879 2930
 	if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
2880 2931
 		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
@@ -2895,7 +2946,7 @@ func (c *HisApiController) GetCFYLJG007() {
2895 2946
 		return
2896 2947
 	} else {
2897 2948
 		c.ServeSuccessJSON(map[string]interface{}{
2898
-			"info": res.Output,
2949
+			"info": res,
2899 2950
 		})
2900 2951
 		return
2901 2952
 	}
@@ -4429,16 +4480,19 @@ func (c *HisApiController) ReadEleToken() {
4429 4480
 					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
4430 4481
 					infoStr := string(Iinfos)
4431 4482
 					idetinfoStr := string(Idetinfos)
4483
+				  //date,age,_  :=  GetBirthdateAndAge(res.Output.Baseinfo.Certno),
4484
+						b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
4485
+
4432 4486
 					psn := &models.HisPsn{
4433 4487
 						PsnNo: res.Output.Baseinfo.PsnNo,
4434
-
4435 4488
 						PatientId: patient.ID,
4436 4489
 						Certno:    res.Output.Baseinfo.Certno,
4437
-
4438 4490
 						Gend:         res.Output.Baseinfo.Gend,
4439 4491
 						Naty:         res.Output.Baseinfo.Naty,
4440 4492
 						PsnCertType:  res.Output.Baseinfo.PsnCertType,
4441 4493
 						PsnName:      res.Output.Baseinfo.PsnName,
4494
+						Age:float64(age),
4495
+						Brdy:b,
4442 4496
 						Idetinfo:     idetinfoStr,
4443 4497
 						Insuinfo:     infoStr,
4444 4498
 						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
@@ -7948,12 +8002,14 @@ func (c *HisApiController) ReadCard() {
7948 8002
 					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
7949 8003
 					infoStr := string(Iinfos)
7950 8004
 					idetinfoStr := string(Idetinfos)
8005
+					b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
8006
+
7951 8007
 					psn := &models.HisPsn{
7952 8008
 						PsnNo: res.Output.Baseinfo.PsnNo,
7953
-
7954 8009
 						PatientId: patient.ID,
7955 8010
 						Certno:    res.Output.Baseinfo.Certno,
7956
-
8011
+						Brdy:        b,
8012
+						Age:float64(age),
7957 8013
 						Gend:        res.Output.Baseinfo.Gend,
7958 8014
 						Naty:        res.Output.Baseinfo.Naty,
7959 8015
 						PsnCertType: res.Output.Baseinfo.PsnCertType,
@@ -8122,12 +8178,14 @@ func (c *HisApiController) ReadCard() {
8122 8178
 							Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
8123 8179
 							infoStr := string(Iinfos)
8124 8180
 							idetinfoStr := string(Idetinfos)
8181
+							b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
8182
+
8125 8183
 							psn := &models.HisPsn{
8126 8184
 								PsnNo: res.Output.Baseinfo.PsnNo,
8127
-
8128 8185
 								PatientId: patient.ID,
8129 8186
 								Certno:    res.Output.Baseinfo.Certno,
8130
-								//Brdy:         res.Output.Baseinfo.Brdy,
8187
+								Brdy:         b,
8188
+								Age:float64(age),
8131 8189
 								Gend:         res.Output.Baseinfo.Gend,
8132 8190
 								Naty:         res.Output.Baseinfo.Naty,
8133 8191
 								PsnCertType:  res.Output.Baseinfo.PsnCertType,
@@ -9958,11 +10016,14 @@ func (c *HisApiController) ReadCard() {
9958 10016
 						Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
9959 10017
 						infoStr := string(Iinfos)
9960 10018
 						idetinfoStr := string(Idetinfos)
10019
+						b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
10020
+
9961 10021
 						psn := &models.HisPsn{
9962 10022
 							PsnNo:     res.Output.Baseinfo.PsnNo,
9963 10023
 							PatientId: patient.ID,
9964 10024
 							Certno:    res.Output.Baseinfo.Certno,
9965
-
10025
+							Brdy:        b,
10026
+							Age:float64(age),
9966 10027
 							//Brdy: res.Output.Baseinfo.Brdy,
9967 10028
 							Gend:         res.Output.Baseinfo.Gend,
9968 10029
 							Naty:         res.Output.Baseinfo.Naty,
@@ -11264,12 +11325,15 @@ func (c *HisApiController) ReadCard() {
11264 11325
 						Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
11265 11326
 						infoStr := string(Iinfos)
11266 11327
 						idetinfoStr := string(Idetinfos)
11328
+
11329
+						b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
11267 11330
 						psn := &models.HisPsn{
11268 11331
 							PsnNo:     res.Output.Baseinfo.PsnNo,
11269 11332
 							PatientId: patient.ID,
11270 11333
 							Certno:    res.Output.Baseinfo.Certno,
11271 11334
 							Gend:      res.Output.Baseinfo.Gend,
11272
-							//Brdy:         res.Output.Baseinfo.Brdy,
11335
+							Brdy:        b,
11336
+							Age:float64(age),
11273 11337
 							Naty:         res.Output.Baseinfo.Naty,
11274 11338
 							PsnCertType:  res.Output.Baseinfo.PsnCertType,
11275 11339
 							PsnName:      res.Output.Baseinfo.PsnName,
@@ -17109,6 +17173,12 @@ type ResultCFYLJG007 struct {
17109 17173
 	InfRefmsgid string `json:"inf_refmsgid"`
17110 17174
 	Infcode     int64  `json:"infcode"`
17111 17175
 	Output      struct {
17176
+		HiRxno           string        `json:"hi_rxno"`
17177
+		RxStasName       string        `json:"rx_stas_name"`
17178
+		RxUsedStasCodg   string        `json:"rx_used_stas_codg"`
17179
+		Seltdelts        []interface{} `json:"seltdelts"`
17180
+		RxUsedStasName   string        `json:"rx_used_stas_name"`
17181
+		RxStasCodg       string        `json:"rx_stas_codg"`
17112 17182
 	} `json:"output"`
17113 17183
 	RefmsgTime  string      `json:"refmsg_time"`
17114 17184
 	RespondTime string      `json:"respond_time"`
@@ -17241,7 +17311,7 @@ type ResultCFYLJG005 struct {
17241 17311
 			SinDosunt       string  `json:"sin_dosunt"`
17242 17312
 			UsedFrquCodg    string  `json:"used_frqu_codg"`
17243 17313
 			UsedFrquName    string  `json:"used_frqu_name"`
17244
-			DrugTotlcnt     float64 `json:"drug_totlcnt"`
17314
+			DrugTotlcnt     string `json:"drug_totlcnt"`
17245 17315
 			DrugTotlcntEmp  string  `json:"drug_totlcnt_emp"`
17246 17316
 			DiseCodg        string  `json:"dise_codg"`
17247 17317
 			HospApprFlag    string  `json:"hosp_appr_flag"`
@@ -21039,6 +21109,8 @@ func (c *HisApiController) GetUploadInfo() {
21039 21109
 							order.Creator = order.Creator
21040 21110
 							order.Modify = roles.AdminUserId
21041 21111
 							order.RequestLog = src_resquest
21112
+						order.FaPiaoNumber =         fapiao_number
21113
+							order.FaPiaoCode =           fapiao_code
21042 21114
 							//setlDetail, _ := json.Marshal(res.Output.Setldetail)
21043 21115
 							//detailStr := string(setlDetail)
21044 21116
 							//order.SetlDetail = detailStr
@@ -22117,6 +22189,8 @@ func (c *HisApiController) GetUploadInfo() {
22117 22189
 				order.Modify = roles.AdminUserId
22118 22190
 				order.RequestLog = src_resquest
22119 22191
 				order.Diagnosis = diagnosis_id
22192
+				order.FaPiaoNumber =         fapiao_number
22193
+				order.FaPiaoCode =           fapiao_code
22120 22194
 				setlDetail, _ := json.Marshal(res.Output.Setldetail)
22121 22195
 				detailStr := string(setlDetail)
22122 22196
 				order.SetlDetail = detailStr
@@ -33027,3 +33101,37 @@ func RemoveRepeatedPurviewElement2(arr []string) (newArr []string) {
33027 33101
 	}
33028 33102
 	return
33029 33103
 }
33104
+
33105
+
33106
+func getBirthdateAndAge(idNumber string) (string, int, error) {
33107
+	if len(idNumber) != 18 {
33108
+		return "", 0, fmt.Errorf("invalid ID number length. It should be 18 digits")
33109
+	}
33110
+
33111
+	// 提取出生日期
33112
+	year, err := strconv.Atoi(idNumber[6:10])
33113
+	if err != nil {
33114
+		return "", 0, err
33115
+	}
33116
+	month, err := strconv.Atoi(idNumber[10:12])
33117
+	if err != nil {
33118
+		return "", 0, err
33119
+	}
33120
+	day, err := strconv.Atoi(idNumber[12:14])
33121
+	if err != nil {
33122
+		return "", 0, err
33123
+	}
33124
+
33125
+	// 格式化生日字符串
33126
+	birthdate := time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)
33127
+	birthdateFormatted := birthdate.Format("2006-01-02")
33128
+
33129
+	// 计算年龄
33130
+	today := time.Now()
33131
+	age := today.Year() - birthdate.Year()
33132
+	if today.YearDay() < birthdate.YearDay() {
33133
+		age--
33134
+	}
33135
+
33136
+	return birthdateFormatted, age, nil
33137
+}

+ 46 - 0
controllers/zh/zh_his_api_controller.go Прегледај датотеку

@@ -3792,6 +3792,52 @@ func (c *ZHHisApiController) GetUploadInfo() {
3792 3792
 
3793 3793
 		var customs []*models.NewCustom
3794 3794
 
3795
+		var empty_code_errs []string
3796
+
3797
+		for _, item := range prescriptions {
3798
+			if item.Type == 1 { //药品
3799
+				for _, subItem := range item.HisDoctorAdviceInfo {
3800
+					if len(subItem.BaseDrugLib.MedicalInsuranceNumber) == 0 {
3801
+
3802
+						empty_code_errs = append(empty_code_errs,subItem.BaseDrugLib.DrugName)
3803
+					}
3804
+				}
3805
+			}
3806
+
3807
+			if item.Type == 2 { //项目
3808
+				for _, subItem := range item.HisPrescriptionProject {
3809
+					//var randNum int
3810
+					//randNum = rand.Intn(10000) + 1000
3811
+					if subItem.Type == 2 {
3812
+						if len(subItem.HisProject.MedicalCode) == 0 {
3813
+							empty_code_errs = append(empty_code_errs,subItem.HisProject.ProjectName)
3814
+
3815
+						}
3816
+					} else if subItem.Type == 3 {
3817
+						if len(subItem.GoodInfo.MedicalInsuranceNumber) == 0 {
3818
+							empty_code_errs = append(empty_code_errs,subItem.GoodInfo.GoodName)
3819
+
3820
+						}
3821
+					}
3822
+				}
3823
+			}
3824
+
3825
+		}
3826
+		if len(empty_code_errs) > 0{
3827
+			var err string
3828
+			for _, item := range empty_code_errs{
3829
+				if len(err) == 0{
3830
+					err = item
3831
+				}else{
3832
+					err = err +"," + item
3833
+				}
3834
+			}
3835
+			c.ServeSuccessJSON(map[string]interface{}{
3836
+				"failed_code": -10,
3837
+				"msg":     err +" "+ "没有填写国家编码",
3838
+			})
3839
+			return
3840
+		}
3795 3841
 		for _, item := range prescriptions {
3796 3842
 			tm := time.Unix(item.PreTime, 0)
3797 3843
 			if item.Type == 1 { //药品

+ 1 - 1
main.go Прегледај датотеку

@@ -49,7 +49,7 @@ func main() {
49 49
 
50 50
 	//深圳百霖
51 51
 	//GetblBatchSettleList()
52
-	//GetblbrBatchSettleList()
52
+	//GetblbrBatchSettleList()8
53 53
 	//深圳百霖贝尔
54 54
 	//GetbrBatchSettleList()
55 55
 

+ 1 - 1
models/cfyljg.go Прегледај датотеку

@@ -243,7 +243,7 @@ type HisPrescriptionFlow struct {
243 243
 	SignCertSn     string `gorm:"column:sign_cert_sn" json:"sign_cert_sn" form:"sign_cert_sn"`
244 244
 	SignCertDn     string `gorm:"column:sign_cert_dn" json:"sign_cert_dn" form:"sign_cert_dn"`
245 245
 	MID            string `gorm:"column:m_id" json:"m_id" form:"m_id"`
246
-	DCode            string `gorm:"column:m_id" json:"m_id" form:"m_id"`
246
+	DCode            string `gorm:"column:d_code" json:"d_code" form:"d_code"`
247 247
 	DID           int64 `gorm:"column:d_id" json:"d_id" form:"d_id"`
248 248
 
249 249
 

+ 6 - 0
service/dianzichufang.go Прегледај датотеку

@@ -745,3 +745,9 @@ func Getflow(id int64) (flow models.HisPrescriptionFlow, err error) {
745 745
 	err = readDb.Model(&models.HisPrescriptionFlow{}).Where("id = ?", id).First(&flow).Error
746 746
 	return
747 747
 }
748
+
749
+
750
+func Getflowtwo(m_id string) (flow models.HisPrescriptionFlow, err error) {
751
+	err = readDb.Model(&models.HisPrescriptionFlow{}).Where("m_id = ?", m_id).First(&flow).Error
752
+	return
753
+}

+ 1 - 0
service/gdyb_service.go Прегледај датотеку

@@ -626,6 +626,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, or
626 626
 
627 627
 	for index, item := range config {
628 628
 		diseinfo_sun := make(map[string]interface{})
629
+
629 630
 		diseinfo_sun["diag_type"] = "1"              // 诊断类别
630 631
 		diseinfo_sun["diag_srt_no"] = index + 1          // 诊断排序号
631 632
 		diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码

+ 3 - 3
service/hbyb_service.go Прегледај датотеку

@@ -2876,7 +2876,7 @@ func Hb2301(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, c
2876 2876
 	fmt.Println("----------")
2877 2877
 	fmt.Println(string(bytesData))
2878 2878
 	fmt.Println("----------")
2879
-	requestLog := string(bytesData)
2879
+	//requestLog := string(bytesData)
2880 2880
 
2881 2881
 	if err != nil {
2882 2882
 		fmt.Println(err.Error())
@@ -2913,7 +2913,7 @@ func Hb2301(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, c
2913 2913
 		fmt.Println(err.Error())
2914 2914
 		return "", ""
2915 2915
 	}
2916
-	return string(respBytes), requestLog
2916
+	return   ConvertToString(string(respBytes), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
2917 2917
 
2918 2918
 }
2919 2919
 func Hb2301A(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, opertor string) (string, string) {
@@ -3103,7 +3103,7 @@ func Hb2303(psnNo string, mdtrtId string, chrgBchno string, certNo string, insut
3103 3103
 		fmt.Println("error:", err.Error())
3104 3104
 	}
3105 3105
 
3106
-	return string(out), string(bytesData)
3106
+	return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
3107 3107
 }
3108 3108
 //  住院结算
3109 3109
 func Hb2304(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, mid_setl_flag string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, fapiao_number string, acct_used_flag string) (string, string) {

+ 1 - 1
service/his_service.go Прегледај датотеку

@@ -1665,7 +1665,7 @@ func Saveflow(flow models.HisPrescriptionFlow) {
1665 1665
 	writeDb.Save(&flow)
1666 1666
 }
1667 1667
 
1668
-func Createflow(flow models.HisPrescriptionFlow) {
1668
+func Createflow(flow *models.HisPrescriptionFlow) {
1669 1669
 	writeDb.Create(&flow)
1670 1670
 }
1671 1671
 

+ 1 - 1
service/hn_service.go Прегледај датотеку

@@ -1633,7 +1633,7 @@ func Hnyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
1633 1633
 	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
1634 1634
 	inputData["ipt_med_type"] = struct4101.IptMedType         // 住院医疗类型  必填
1635 1635
 	inputData["adm_way"] = ""                                 // 入院途径  必填
1636
-	inputData["trt_type"] = ""                                // 治疗类别  必填
1636
+	inputData["trt_type"] = "10"                                // 治疗类别  必填
1637 1637
 	inputData["adm_time"] = struct4101.AdmTime                // 入院时间  必填
1638 1638
 	inputData["adm_caty"] = struct4101.AdmCaty                // 入院科别  必填
1639 1639
 	inputData["refldept_dept"] = ""                           // 转科科别  必填

+ 4 - 4
service/jsyb_service.go Прегледај датотеку

@@ -1040,11 +1040,11 @@ func SetJSInputMessage(timestamp int64, org_name string, doctor string, fixmedin
1040 1040
 	inputMessage["infver"] = "1.0.0"                                                            // 接收方系统代码
1041 1041
 	inputMessage["opter_type"] = "1"                                                            // 经办人类别
1042 1042
 	if fixmedins_code == "H32090403023" {
1043
-		inputMessage["opter"] = doctor      // 经办人
1044
-		inputMessage["opter_name"] = doctor // 经办人姓名
1043
+		inputMessage["opter"] = "葛美琴"      // 经办人
1044
+		inputMessage["opter_name"] = "葛美琴" // 经办人姓名
1045 1045
 	} else {
1046
-		inputMessage["opter"] = doctor      // 经办人
1047
-		inputMessage["opter_name"] = doctor // 经办人姓名
1046
+		inputMessage["opter"] = "孙欣欣"      // 经办人
1047
+		inputMessage["opter_name"] = "孙欣欣" // 经办人姓名
1048 1048
 	}
1049 1049
 	inputMessage["inf_time"] = timeFormatOne        // 交易时间
1050 1050
 	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号