csx 4 gadus atpakaļ
vecāks
revīzija
f8b404834b

+ 70 - 34
controllers/his_api_controller.go Parādīt failu

@@ -79,43 +79,43 @@ func HisManagerApiRegistRouters() {
79 79
 }
80 80
 
81 81
 func (c *HisApiController) Sscard() {
82
-	r := CardInit()
83
-	if r == 0 {
84
-		GetBaseInfo()
85
-	}
86
-	c.ServeSuccessJSON(map[string]interface{}{
87
-		"list": "11",
88
-	})
82
+	//r := CardInit()
83
+	//if r == 0 {
84
+	//	GetBaseInfo()
85
+	//}
86
+	//c.ServeSuccessJSON(map[string]interface{}{
87
+	//	"list": "11",
88
+	//})
89 89
 
90 90
 }
91 91
 
92 92
 func GetBaseInfo() error {
93
-	handle := syscall.MustLoadDLL("SSCard.dll")
94
-	ReadCardBas := handle.MustFindProc("ReadCardBas")
95
-
96
-	str := make([]byte, 256)
97
-	str1 := make([]byte, 256)
98
-	r, _, ferr := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
99
-	if ferr != nil {
100
-		fmt.Println("ReadCardBas 报错", ferr.Error())
101
-		return ferr
102
-	}
103
-
104
-	fmt.Println(string(str))
105
-
106
-	fmt.Println(r)
93
+	//handle := syscall.MustLoadDLL("SSCard.dll")
94
+	//ReadCardBas := handle.MustFindProc("ReadCardBas")
95
+	//
96
+	//str := make([]byte, 256)
97
+	//str1 := make([]byte, 256)
98
+	//r, _, ferr := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
99
+	//if ferr != nil {
100
+	//	fmt.Println("ReadCardBas 报错", ferr.Error())
101
+	//	return ferr
102
+	//}
103
+	//
104
+	//fmt.Println(string(str))
105
+	//
106
+	//fmt.Println(r)
107 107
 	return nil
108 108
 }
109 109
 
110 110
 func CardInit() int {
111
-	DllTestDef := syscall.MustLoadDLL("SSCard.dll")
112
-	add := DllTestDef.MustFindProc("Init")
113
-	ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
114
-	if err != nil {
115
-		fmt.Println("SSCard的运算结果为:", ret)
116
-	}
117
-	result := int(ret)
118
-	return result
111
+	//DllTestDef := syscall.MustLoadDLL("SSCard.dll")
112
+	//add := DllTestDef.MustFindProc("Init")
113
+	//ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
114
+	//if err != nil {
115
+	//	fmt.Println("SSCard的运算结果为:", ret)
116
+	//}
117
+	//result := int(ret)
118
+	return 0
119 119
 }
120 120
 
121 121
 func IntPtr(n int) uintptr {
@@ -376,6 +376,19 @@ func (c *HisApiController) CreateHisPrescription() {
376 376
 				}
377 377
 				types := int64(items["type"].(float64))
378 378
 
379
+				if items["pre_time"] == nil || reflect.TypeOf(items["pre_time"]).String() != "string" {
380
+					utils.ErrorLog("pre_time")
381
+				}
382
+				preTime, _ := items["pre_time"].(string)
383
+				timeLayout := "2006-01-02"
384
+				loc, _ := time.LoadLocation("Local")
385
+				theTime2, err := time.ParseInLocation(timeLayout+" 15:04", preTime, loc)
386
+				if err != nil {
387
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
388
+					return
389
+				}
390
+				pTime := theTime2.Unix()
391
+
379 392
 				ctime := time.Now().Unix()
380 393
 				prescription := &models.HisPrescription{
381 394
 					ID:                 id,
@@ -393,12 +406,13 @@ func (c *HisApiController) CreateHisPrescription() {
393 406
 					OrderStatus:        1,
394 407
 					BatchNumber:        "",
395 408
 					PrescriptionNumber: hpInfo.PrescriptionNumber,
409
+					PreTime:            pTime,
396 410
 				}
397 411
 				service.SaveHisPrescription(prescription)
398 412
 
399 413
 				//更改患者挂号状态
400
-				_, err := service.UpdateHisPatientIsReturn(patient_id, recordDateTime, adminInfo.CurrentOrgId)
401
-				fmt.Println("更改失败", err)
414
+				_, err2 := service.UpdateHisPatientIsReturn(patient_id, recordDateTime, adminInfo.CurrentOrgId)
415
+				fmt.Println("更改失败", err2)
402 416
 				if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
403 417
 					advices := items["advices"].([]interface{})
404 418
 					//group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
@@ -417,7 +431,7 @@ func (c *HisApiController) CreateHisPrescription() {
417 431
 							s.Status = 1
418 432
 							s.UserOrgId = adminInfo.CurrentOrgId
419 433
 							s.RecordDate = recordDateTime
420
-							s.StartTime = time.Now().Unix()
434
+							s.StartTime = prescription.PreTime
421 435
 							s.Groupno = groupNo
422 436
 							s.CreatedTime = ctime
423 437
 							s.UpdatedTime = mtime
@@ -486,7 +500,7 @@ func (c *HisApiController) CreateHisPrescription() {
486 500
 							s.UpdatedTime = mtime
487 501
 							s.PatientId = patient_id
488 502
 							s.HisPatientId = his_patient_id
489
-							errcode := c.setAddtionWithJSON(&s, item.(map[string]interface{}))
503
+							errcode := c.setAddtionWithJSON(&s, item.(map[string]interface{}), adminInfo.CurrentOrgId)
490 504
 							if errcode > 0 {
491 505
 								c.ServeFailJSONWithSGJErrorCode(errcode)
492 506
 								return
@@ -896,6 +910,21 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
896 910
 	if json["advice_id"] != nil && reflect.TypeOf(json["advice_id"]).String() == "float64" {
897 911
 		advice_id := int64(json["advice_id"].(float64))
898 912
 		advice.ID = advice_id
913
+		if advice.ID > 0 {
914
+			hisAdvice, err := service.GetHisDoctorAdvicesById(advice.ID)
915
+			if err == nil {
916
+				if hisAdvice.ID > 0 {
917
+					advice.ExecutionTime = hisAdvice.ExecutionTime
918
+					advice.ExecutionStaff = hisAdvice.ExecutionStaff
919
+					advice.ExecutionState = hisAdvice.ExecutionState
920
+					advice.CheckTime = hisAdvice.CheckTime
921
+					advice.Checker = hisAdvice.Checker
922
+					advice.CheckState = hisAdvice.CheckState
923
+					advice.StartTime = hisAdvice.StartTime
924
+
925
+				}
926
+			}
927
+		}
899 928
 	}
900 929
 
901 930
 	if json["min_unit"] != nil && reflect.TypeOf(json["min_unit"]).String() == "string" {
@@ -1004,7 +1033,7 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
1004 1033
 	return 0
1005 1034
 }
1006 1035
 
1007
-func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditionalCharge, json map[string]interface{}) int {
1036
+func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditionalCharge, json map[string]interface{}, org_id int64) int {
1008 1037
 	if json["id"] != nil || reflect.TypeOf(json["id"]).String() == "float64" {
1009 1038
 		id := int64(json["id"].(float64))
1010 1039
 		additionalCharge.ID = id
@@ -1012,7 +1041,14 @@ func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditi
1012 1041
 	if json["item_id"] != nil || reflect.TypeOf(json["item_id"]).String() == "float64" {
1013 1042
 		item_id := int64(json["item_id"].(float64))
1014 1043
 		additionalCharge.ItemId = item_id
1044
+		config, _ := service.GetAdditionChargeByID(org_id, item_id)
1045
+		if config.ID > 0 {
1046
+			if len(config.Code) > 0 {
1047
+				additionalCharge.MedListCodg = config.Code
1048
+			}
1049
+		}
1015 1050
 	}
1051
+
1016 1052
 	//if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
1017 1053
 	//	price := int64(json["price"].(float64))
1018 1054
 	//	formatInt_price := strconv.FormatInt(price, 10)

+ 2 - 0
models/his_models.go Parādīt failu

@@ -310,6 +310,7 @@ type HisPrescription struct {
310 310
 	Creator                int64                     `gorm:"column:creator" json:"creator" form:"creator"`
311 311
 	Modifier               int64                     `gorm:"column:modifier" json:"modifier" form:"modifier"`
312 312
 	OrderStatus            int64                     `gorm:"column:order_status" json:"order_status" form:"order_status"`
313
+	PreTime                int64                     `gorm:"column:pre_time" json:"pre_time" form:"pre_time"`
313 314
 	BatchNumber            string                    `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
314 315
 	PrescriptionNumber     string                    `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
315 316
 	Patients               Patients                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
@@ -401,6 +402,7 @@ type HisAdditionalCharge struct {
401 402
 	FeedetlSn          string             `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
402 403
 	PrescriptionId     int64              `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
403 404
 	Count              int64              `gorm:"column:count" json:"count" form:"count"`
405
+	MedListCodg        string             `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
404 406
 }
405 407
 
406 408
 func (HisAdditionalCharge) TableName() string {

+ 1 - 1
service/his_project_service.go Parādīt failu

@@ -56,7 +56,7 @@ func GetProjectDetail(id int64) (models.XtHisProject, error) {
56 56
 
57 57
 func UpdatedProject(id int64, pro *models.XtHisProject) error {
58 58
 
59
-	err := XTWriteDB().Model(&pro).Where("id=?", id).Updates(map[string]interface{}{"project_name": pro.ProjectName, "pinyin": pro.Pinyin, "wubi": pro.Pinyin, "price": pro.Price, "unit": pro.Unit, "cost_classify": pro.CostClassify, "executive_section": pro.ExecutiveSection, "medical_coverage": pro.MedicalCoverage, "statistical_classification": pro.MedicalCoverage, "disease_directory": pro.DiseaseDirectory, "is_record": pro.DiseaseDirectory, "medical_code": pro.MedicalCode, "tube_color": pro.TubeColor, "medical_status": pro.MedicalStatus, "remark": pro.Remark, "sign": pro.Sign, "default_number": pro.DefaultNumber, "is_default": pro.IsDefault, "is_charge": pro.IsCharge, "is_estimate": pro.IsEstimate, "is_workload": pro.IsWorkload, "sort": pro.Sort, "doctor_advice": pro.DoctorAdvice, "single_dose": pro.SingleDose, "execution_frequency": pro.ExecutionFrequency, "delivery_way": pro.ExecutionFrequency, "number_days": pro.ExecutionFrequency, "total": pro.Total, "updated_time": pro.UpdatedTime}).Error
59
+	err := XTWriteDB().Model(&pro).Where("id=?", id).Updates(map[string]interface{}{"project_name": pro.ProjectName, "pinyin": pro.Pinyin, "wubi": pro.Pinyin, "price": pro.Price, "unit": pro.Unit, "cost_classify": pro.CostClassify, "executive_section": pro.ExecutiveSection, "medical_coverage": pro.MedicalCoverage, "statistical_classification": pro.StatisticalClassification, "disease_directory": pro.DiseaseDirectory, "is_record": pro.IsRecord, "medical_code": pro.MedicalCode, "tube_color": pro.TubeColor, "medical_status": pro.MedicalStatus, "remark": pro.Remark, "sign": pro.Sign, "default_number": pro.DefaultNumber, "is_default": pro.IsDefault, "is_charge": pro.IsCharge, "is_estimate": pro.IsEstimate, "is_workload": pro.IsWorkload, "sort": pro.Sort, "doctor_advice": pro.DoctorAdvice, "single_dose": pro.SingleDose, "execution_frequency": pro.ExecutionFrequency, "delivery_way": pro.DeliveryWay, "number_days": pro.NumberDays, "total": pro.Total, "updated_time": pro.UpdatedTime}).Error
60 60
 	return err
61 61
 }
62 62
 

+ 12 - 0
service/his_service.go Parādīt failu

@@ -817,3 +817,15 @@ func GetOrderByTimeTwo(start_time int64, end_time int64, org_id int64) (orders [
817 817
 	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND is_medicine_insurance = 1 AND settle_accounts_date <= ? AND settle_accounts_date >= ? ", org_id, end_time, start_time).Find(&orders).Error
818 818
 	return
819 819
 }
820
+
821
+func GetHisDoctorAdvicesById(id int64) (advice models.HisDoctorAdviceInfo, err error) {
822
+	err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("status = 1 AND id = ?", id).First(&advice).Error
823
+	return
824
+
825
+}
826
+
827
+func GetAdditionChargeByID(org_id int64, id int64) (addition models.XtHisAddtionConfig, err error) {
828
+	err = readDb.Model(&models.XtHisAddtionConfig{}).Where("status = 1 AND user_org_id = ? AND id = ?", org_id, id).First(&addition).Error
829
+	return
830
+
831
+}